package com.sondon.mayi.util;

import com.sondon.mayi.application.ProjectApplication;

/**
 * @Project : Fruit
 * @Package : com.sondon.mayi.util
 * @Class : PreferencesUtil
 * @Company 广州讯动网络科技有限公司
 * @Author : 蔡文锋
 * @DateTime：2015年5月30日 下午11:45:53
 * @Blog：http://blog.csdn.net/caiwenfeng_for_23
 * @Description : {}
 *
 */
public class PreferencesUtil {
	
	public static boolean putStringValue(String key, String value) {
		return ProjectApplication.preferences.edit().putString(key, value.trim()).commit();
	}

	public static boolean putStringValue(String key, int value) {
		return ProjectApplication.preferences.edit().putInt(key, value).commit();
	}

	public static boolean putStringValue(String key, float value) {
		return ProjectApplication.preferences.edit().putFloat(key, value).commit();
	}

	public static boolean putStringValue(String key, boolean value) {
		return ProjectApplication.preferences.edit().putBoolean(key, value).commit();
	}

	public static String getStringValue(String key) {
		return ProjectApplication.preferences.getString(key, "");
	}

	public static int getIntValue(String key) {
		return ProjectApplication.preferences.getInt(key, 0);
	}

	public static float getFloatValue(String key) {
		return ProjectApplication.preferences.getFloat(key, 0f);
	}

	public static boolean getBooleanValue(String key) {
		return ProjectApplication.preferences.getBoolean(key, false);
	}

}
